package com.hcz.controller;

import com.hcz.client.UserClient;
import com.hcz.pojjo.User;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @author hcz
 * @describtion TODO
 * @date 2019-06-21 12:48
 */
@RestController
@RequestMapping("user")
public class UserController {

   @Autowired
   private UserClient userClient;

    @RequestMapping("{id}")
/*    @HystrixCommand(fallbackMethod = "getUserFallBack")*/
    public String getUser(@PathVariable("id")Long id){
        return userClient.getUser(id);
    }

  /*  public String getUserFallBack(Long id){
      return "服务繁忙"+id;
    }*/
}
